package com.doradance.app.home;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.doradance.R;
import com.doradance.app.activity.ActivityDetailActivity;
import com.doradance.common.web.CommonWebviewFragment;
import com.pachong.android.baseuicomponent.activity.BaseActivity;

public class EvaluatingActivity extends BaseActivity {
    private String url;
    private CommonWebviewFragment mWebviewFragment;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        url = getIntent().getStringExtra("url");
        initToolsBar();
        if(!TextUtils.isEmpty(url)){
            mWebviewFragment = CommonWebviewFragment.newInstance(url);
            getSupportFragmentManager().beginTransaction().add(R.id.fl_evaluating, mWebviewFragment).commit();
        }else{
            getSupportFragmentManager().beginTransaction().add(R.id.fl_evaluating, new EmptyEvaluatingFragment()).commit();
        }

    }

    @Override
    public View createDataView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.activity_evaluating,null);
    }

    private void initToolsBar() {
        setTitle("学习测评");
        getCustomToolbar().addLeftImageButton(R.mipmap.back, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    public static void start(Activity activity, String url){
        Intent intent = new Intent(activity, EvaluatingActivity.class);
        intent.putExtra("url",url);
        activity.startActivity(intent);
    }


}
